home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2008 April / PCgo 2008-04 (DVD).iso / interface / contents / demoversionen_3846 / 13664 / files / Data1.cab / formrect.vb < prev    next >
Encoding:
Text File  |  2004-07-15  |  11.1 KB  |  283 lines

  1. '******************************************************************'
  2. '*                                                                *'
  3. '*                      TurboCAD for Windows                      *'
  4. '*                   Copyright (c) 1993 - 2004                    *'
  5. '*             International Microcomputer Software, Inc.         *'
  6. '*                            (IMSI)                              *'
  7. '*                      All rights reserved.                      *'
  8. '*                                                                *'
  9. '******************************************************************'
  10. Public Class frmRRect
  11.     Inherits System.Windows.Forms.Form
  12.  
  13. #Region " Windows Form Designer generated code "
  14.  
  15.     Public Sub New()
  16.         MyBase.New()
  17.  
  18.         'This call is required by the Windows Form Designer.
  19.         InitializeComponent()
  20.  
  21.         'Add any initialization after the InitializeComponent() call
  22.         cModesCombo.Items.Add("Horizontal")
  23.         cModesCombo.Items.Add("Vertical")
  24.         cModesCombo.Items.Add("ForwardDiagonal")
  25.         cModesCombo.Items.Add("BackwardDiagonal")
  26.         cModesCombo.SelectedIndex = 0
  27.         rRect = New Drawing.Rectangle(0, 0, picPreview.Width, picPreview.Height)
  28.         bMode = Drawing.Drawing2D.LinearGradientMode.Horizontal
  29.  
  30.         bCanceled = True
  31.         bShowPreview = True
  32.     End Sub
  33.  
  34.     'Form overrides dispose to clean up the component list.
  35.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  36.         If disposing Then
  37.             If Not (components Is Nothing) Then
  38.                 components.Dispose()
  39.             End If
  40.         End If
  41.         MyBase.Dispose(disposing)
  42.     End Sub
  43.  
  44.     'Required by the Windows Form Designer
  45.     Private components As System.ComponentModel.IContainer
  46.  
  47.     'NOTE: The following procedure is required by the Windows Form Designer
  48.     'It can be modified using the Windows Form Designer.  
  49.     'Do not modify it using the code editor.
  50.     Friend WithEvents picPreview As System.Windows.Forms.PictureBox
  51.     Friend WithEvents cmOK As System.Windows.Forms.Button
  52.     Friend WithEvents cmCancel As System.Windows.Forms.Button
  53.     Friend WithEvents Label1 As System.Windows.Forms.Label
  54.     Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog
  55.     Friend WithEvents Label2 As System.Windows.Forms.Label
  56.     Friend WithEvents Label3 As System.Windows.Forms.Label
  57.     Friend WithEvents cmColor1 As System.Windows.Forms.Panel
  58.     Friend WithEvents cmColor2 As System.Windows.Forms.Panel
  59.     Friend WithEvents Label4 As System.Windows.Forms.Label
  60.     Friend WithEvents cModesCombo As System.Windows.Forms.ComboBox
  61.     Friend WithEvents Label5 As System.Windows.Forms.Label
  62.     Friend WithEvents tbRoundness As System.Windows.Forms.TextBox
  63.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  64.         Me.picPreview = New System.Windows.Forms.PictureBox
  65.         Me.cmOK = New System.Windows.Forms.Button
  66.         Me.cmCancel = New System.Windows.Forms.Button
  67.         Me.Label1 = New System.Windows.Forms.Label
  68.         Me.ColorDialog1 = New System.Windows.Forms.ColorDialog
  69.         Me.cmColor1 = New System.Windows.Forms.Panel
  70.         Me.Label2 = New System.Windows.Forms.Label
  71.         Me.Label3 = New System.Windows.Forms.Label
  72.         Me.cmColor2 = New System.Windows.Forms.Panel
  73.         Me.cModesCombo = New System.Windows.Forms.ComboBox
  74.         Me.Label4 = New System.Windows.Forms.Label
  75.         Me.tbRoundness = New System.Windows.Forms.TextBox
  76.         Me.Label5 = New System.Windows.Forms.Label
  77.         Me.SuspendLayout()
  78.         '
  79.         'picPreview
  80.         '
  81.         Me.picPreview.BackColor = System.Drawing.Color.Transparent
  82.         Me.picPreview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
  83.         Me.picPreview.Location = New System.Drawing.Point(248, 48)
  84.         Me.picPreview.Name = "picPreview"
  85.         Me.picPreview.Size = New System.Drawing.Size(168, 144)
  86.         Me.picPreview.TabIndex = 0
  87.         Me.picPreview.TabStop = False
  88.         '
  89.         'cmOK
  90.         '
  91.         Me.cmOK.Location = New System.Drawing.Point(320, 232)
  92.         Me.cmOK.Name = "cmOK"
  93.         Me.cmOK.Size = New System.Drawing.Size(80, 24)
  94.         Me.cmOK.TabIndex = 1
  95.         Me.cmOK.Text = "OK"
  96.         '
  97.         'cmCancel
  98.         '
  99.         Me.cmCancel.Location = New System.Drawing.Point(224, 232)
  100.         Me.cmCancel.Name = "cmCancel"
  101.         Me.cmCancel.Size = New System.Drawing.Size(80, 24)
  102.         Me.cmCancel.TabIndex = 1
  103.         Me.cmCancel.Text = "Cancel"
  104.         '
  105.         'Label1
  106.         '
  107.         Me.Label1.Location = New System.Drawing.Point(240, 8)
  108.         Me.Label1.Name = "Label1"
  109.         Me.Label1.Size = New System.Drawing.Size(168, 24)
  110.         Me.Label1.TabIndex = 2
  111.         Me.Label1.Text = "Preview: "
  112.         '
  113.         'cmColor1
  114.         '
  115.         Me.cmColor1.BackColor = System.Drawing.SystemColors.Desktop
  116.         Me.cmColor1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
  117.         Me.cmColor1.Location = New System.Drawing.Point(104, 53)
  118.         Me.cmColor1.Name = "cmColor1"
  119.         Me.cmColor1.Size = New System.Drawing.Size(96, 24)
  120.         Me.cmColor1.TabIndex = 4
  121.         '
  122.         'Label2
  123.         '
  124.         Me.Label2.Location = New System.Drawing.Point(8, 56)
  125.         Me.Label2.Name = "Label2"
  126.         Me.Label2.Size = New System.Drawing.Size(88, 16)
  127.         Me.Label2.TabIndex = 5
  128.         Me.Label2.Text = "Start Color:"
  129.         '
  130.         'Label3
  131.         '
  132.         Me.Label3.Location = New System.Drawing.Point(8, 104)
  133.         Me.Label3.Name = "Label3"
  134.         Me.Label3.Size = New System.Drawing.Size(88, 16)
  135.         Me.Label3.TabIndex = 5
  136.         Me.Label3.Text = "End Color:"
  137.         '
  138.         'cmColor2
  139.         '
  140.         Me.cmColor2.BackColor = System.Drawing.SystemColors.Desktop
  141.         Me.cmColor2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
  142.         Me.cmColor2.Location = New System.Drawing.Point(104, 99)
  143.         Me.cmColor2.Name = "cmColor2"
  144.         Me.cmColor2.Size = New System.Drawing.Size(96, 24)
  145.         Me.cmColor2.TabIndex = 4
  146.         '
  147.         'cModesCombo
  148.         '
  149.         Me.cModesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
  150.         Me.cModesCombo.Location = New System.Drawing.Point(104, 144)
  151.         Me.cModesCombo.Name = "cModesCombo"
  152.         Me.cModesCombo.Size = New System.Drawing.Size(96, 21)
  153.         Me.cModesCombo.TabIndex = 7
  154.         '
  155.         'Label4
  156.         '
  157.         Me.Label4.Location = New System.Drawing.Point(8, 144)
  158.         Me.Label4.Name = "Label4"
  159.         Me.Label4.Size = New System.Drawing.Size(88, 16)
  160.         Me.Label4.TabIndex = 5
  161.         Me.Label4.Text = "Mode:"
  162.         '
  163.         'tbRoundness
  164.         '
  165.         Me.tbRoundness.Location = New System.Drawing.Point(104, 192)
  166.         Me.tbRoundness.Name = "tbRoundness"
  167.         Me.tbRoundness.Size = New System.Drawing.Size(96, 20)
  168.         Me.tbRoundness.TabIndex = 8
  169.         Me.tbRoundness.Text = "0"
  170.         '
  171.         'Label5
  172.         '
  173.         Me.Label5.Location = New System.Drawing.Point(8, 194)
  174.         Me.Label5.Name = "Label5"
  175.         Me.Label5.Size = New System.Drawing.Size(88, 16)
  176.         Me.Label5.TabIndex = 5
  177.         Me.Label5.Text = "Roundness:"
  178.         '
  179.         'frmRRect
  180.         '
  181.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  182.         Me.ClientSize = New System.Drawing.Size(432, 273)
  183.         Me.Controls.Add(Me.tbRoundness)
  184.         Me.Controls.Add(Me.cModesCombo)
  185.         Me.Controls.Add(Me.Label2)
  186.         Me.Controls.Add(Me.cmColor1)
  187.         Me.Controls.Add(Me.Label1)
  188.         Me.Controls.Add(Me.cmOK)
  189.         Me.Controls.Add(Me.picPreview)
  190.         Me.Controls.Add(Me.cmCancel)
  191.         Me.Controls.Add(Me.Label3)
  192.         Me.Controls.Add(Me.cmColor2)
  193.         Me.Controls.Add(Me.Label4)
  194.         Me.Controls.Add(Me.Label5)
  195.         Me.Name = "frmRRect"
  196.         Me.Text = "FormRect"
  197.         Me.ResumeLayout(False)
  198.  
  199.     End Sub
  200.  
  201. #End Region
  202.     Dim Grs As Drawing.Graphics
  203.     Dim LB As Drawing.Drawing2D.LinearGradientBrush
  204.     Dim rRect As Drawing.Rectangle
  205.     Dim bMode As Drawing.Drawing2D.LinearGradientMode
  206.     Dim bShowPreview As Boolean
  207.     Public bCanceled As Boolean
  208.     Private Sub cmCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmCancel.Click
  209.         bCanceled = True
  210.         LB = Nothing
  211.         Me.Close()
  212.     End Sub
  213.  
  214.     Private Sub cmColor1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmColor1.Click
  215.         Dim Clr As Drawing.Color
  216.         ColorDialog1.ShowDialog(Me)
  217.         Clr = ColorDialog1.Color
  218.         cmColor1.BackColor = Clr
  219.         bShowPreview = False
  220.         LB = Nothing
  221.         LB = New Drawing.Drawing2D.LinearGradientBrush(rRect, cmColor1.BackColor, cmColor2.BackColor, bMode)
  222.         bShowPreview = True
  223.  
  224.         picPreview.Refresh()
  225.     End Sub
  226.     Private Sub cmColor2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmColor2.Click
  227.         Dim Clr As Drawing.Color
  228.         ColorDialog1.ShowDialog(Me)
  229.         Clr = ColorDialog1.Color
  230.         cmColor2.BackColor = Clr
  231.         bShowPreview = False
  232.         LB = Nothing
  233.         LB = New Drawing.Drawing2D.LinearGradientBrush(rRect, cmColor1.BackColor, cmColor2.BackColor, bMode)
  234.         bShowPreview = True
  235.  
  236.         picPreview.Refresh()
  237.     End Sub
  238.  
  239.  
  240.     Private Sub picPreview_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles picPreview.Paint
  241.         If bShowPreview Then
  242.             If LB Is Nothing Then
  243.                 LB = New Drawing.Drawing2D.LinearGradientBrush(rRect, cmColor1.BackColor, cmColor2.BackColor, bMode)
  244.             End If
  245.             e.Graphics.FillRectangle(LB, rRect)
  246.         End If
  247.     End Sub
  248.  
  249.     Private Sub cModesCombo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cModesCombo.SelectedIndexChanged
  250.         Dim bNewMode As Drawing.Drawing2D.LinearGradientMode
  251.         bNewMode = bMode
  252.         Select Case cModesCombo.SelectedItem.ToString()
  253.             Case "Horizontal"
  254.                 bNewMode = Drawing.Drawing2D.LinearGradientMode.Horizontal
  255.                 Exit Select
  256.             Case "Vertical"
  257.                 bNewMode = Drawing.Drawing2D.LinearGradientMode.Vertical
  258.                 Exit Select
  259.             Case "ForwardDiagonal"
  260.                 bNewMode = Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal
  261.                 Exit Select
  262.             Case "BackwardDiagonal"
  263.                 bNewMode = Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal
  264.                 Exit Select
  265.         End Select
  266.         If bMode <> bNewMode Then
  267.             bShowPreview = False
  268.             LB = Nothing
  269.             LB = New Drawing.Drawing2D.LinearGradientBrush(rRect, cmColor1.BackColor, cmColor2.BackColor, bNewMode)
  270.             bShowPreview = True
  271.             picPreview.Refresh()
  272.             bMode = bNewMode
  273.         End If
  274.  
  275.     End Sub
  276.  
  277.     Private Sub cmOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmOK.Click
  278.         bCanceled = False
  279.         LB = Nothing
  280.         Me.Hide()
  281.     End Sub
  282. End Class
  283.